#pragma GCC optimize(2)
#include <iostream>
#include <algorithm>
#include <cstring>
#include <string>
#include <map>
#include <unordered_map>
#include <vector>
#include <set>
#include <queue>
using namespace std;

using LL = long long;
const LL mod = 998244353;

const LL N = 2e5 + 10;

LL n;
LL A[N];
LL trnum[N], trsum[N];


LL qmi(LL a, LL b, LL p){
    LL res = 1;
    while(b){
        if(b & 1) res = res * a % p;
         
        a = a * a % p;
        b >>= 1;
    }
    return res;
}

LL lowbit(LL x){
    return x & (-x);
}

void add(LL q[], LL x, LL k){
    for(int i = x; i < N; i += lowbit(i)){
        q[i] += k;
    }
}

LL sum(LL q[], LL x){
    LL res = 0;
    for(int i = x; i > 0; i -= lowbit(i)){
        res += q[i];
    }
    return res;
}

LL f(LL q[], LL l, LL r){
    return sum(q, r) - sum(q, l - 1);
}

int main(){
#ifdef LOCALFLAG
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
#endif

    cin >> n;
    LL t = 0;
    for(int i = 1; i <= n; i ++) cin >> A[i];

    for(int i = 1; i <= n; i ++){
        LL precnt = sum(trnum, A[i]);
        LL nesum = f(trsum, A[i] + 1, N - 1);

        LL sum2 = precnt * A[i] % mod * 2 % mod;
        sum2 = (sum2 + nesum * 2 % mod) % mod;
        sum2 = (sum2 + A[i]) % mod;
        sum2 = (sum2 + t) % mod;
        t = sum2;

        add(trnum, A[i], 1);
        add(trsum, A[i], A[i]);


        LL down = (LL)i * i % mod;
        down = qmi(down, mod - 2, mod);

        LL res = sum2 * down % mod;
        cout << res << '\n'; 
    }
    return 0;
}